{% extends 'base.html' %}
{% load static %}

{% block title %}删除资产确认 - 固定资产管理系统{% endblock %}

{% block extra_css %}
<style>
    .delete-warning {
        background: linear-gradient(135deg, #ff6b6b, #ee5a52);
        color: white;
        border-radius: 10px;
        padding: 2rem;
        margin-bottom: 2rem;
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    }
    
    .delete-warning i {
        font-size: 3rem;
        margin-bottom: 1rem;
    }
    
    .asset-info {
        background: #f8f9fa;
        border-radius: 10px;
        padding: 1.5rem;
        margin-bottom: 2rem;
    }
    
    .info-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border-bottom: 1px solid #dee2e6;
    }
    
    .info-item:last-child {
        border-bottom: none;
    }
    
    .info-label {
        font-weight: 600;
        color: #495057;
    }
    
    .info-value {
        color: #6c757d;
    }
    
    .btn-danger-custom {
        background: linear-gradient(135deg, #dc3545, #c82333);
        border: none;
        padding: 0.75rem 2rem;
        font-weight: 600;
        border-radius: 8px;
        transition: all 0.3s ease;
    }
    
    .btn-danger-custom:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
    }
    
    .btn-secondary-custom {
        background: #6c757d;
        border: none;
        padding: 0.75rem 2rem;
        font-weight: 600;
        border-radius: 8px;
        transition: all 0.3s ease;
    }
    
    .btn-secondary-custom:hover {
        background: #5a6268;
        transform: translateY(-2px);
        box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4);
    }
</style>
{% endblock %}

{% block content %}
<div class="container-fluid">
    <div class="row justify-content-center">
        <div class="col-md-8 col-lg-6">
            <!-- 警告提示 -->
            <div class="delete-warning text-center">
                <i class="fas fa-exclamation-triangle"></i>
                <h3>确认删除资产</h3>
                <p class="mb-0">此操作不可撤销，请谨慎操作</p>
            </div>
            
            <!-- 资产信息 -->
            <div class="asset-info">
                <h5 class="mb-3">
                    <i class="fas fa-desktop text-primary"></i> 资产详细信息
                </h5>
                
                <div class="info-item">
                    <span class="info-label">资产名称：</span>
                    <span class="info-value">{{ asset.name }}</span>
                </div>
                
                <div class="info-item">
                    <span class="info-label">资产编号：</span>
                    <span class="info-value">{{ asset.asset_number }}</span>
                </div>
                
                <div class="info-item">
                    <span class="info-label">资产类别：</span>
                    <span class="info-value">{{ asset.category.name }}</span>
                </div>
                
                {% if asset.department %}
                <div class="info-item">
                    <span class="info-label">所属部门：</span>
                    <span class="info-value">{{ asset.department.name }}</span>
                </div>
                {% endif %}
                
                {% if asset.user %}
                <div class="info-item">
                    <span class="info-label">使用人：</span>
                    <span class="info-value">{% if asset.user %}{{ asset.user.get_full_name|default:asset.user.username }}{% else %}-{% endif %}</span>
                </div>
                {% endif %}
                
                <div class="info-item">
                    <span class="info-label">当前状态：</span>
                    <span class="info-value">{{ asset.get_status_display }}</span>
                </div>
                
                {% if asset.purchase_price %}
                <div class="info-item">
                    <span class="info-label">购入价格：</span>
                    <span class="info-value">¥{{ asset.purchase_price }}</span>
                </div>
                {% endif %}
                
                {% if asset.purchase_date %}
                <div class="info-item">
                    <span class="info-label">购入日期：</span>
                    <span class="info-value">{{ asset.purchase_date|date:"Y-m-d" }}</span>
                </div>
                {% endif %}
                
                <div class="info-item">
                    <span class="info-label">创建时间：</span>
                    <span class="info-value">{{ asset.created_at|date:"Y-m-d H:i:s" }}</span>
                </div>
            </div>
            
            <!-- 影响提示 -->
            <div class="alert alert-warning">
                <h6><i class="fas fa-exclamation-circle"></i> 删除影响</h6>
                <ul class="mb-0">
                    <li>该资产的所有操作记录将被保留</li>
                    <li>相关的借用记录将无法查询到资产详情</li>
                    <li>维修记录和盘点记录将受到影响</li>
                    <li>如果资产正在使用中，建议先更改状态</li>
                </ul>
            </div>
            
            <!-- 确认删除表单 -->
            <form method="post" class="text-center">
                {% csrf_token %}
                <div class="d-flex justify-content-center gap-3">
                    <a href="{% url 'assets:asset_list' %}" class="btn btn-secondary-custom">
                        <i class="fas fa-times"></i> 取消
                    </a>
                    <button type="submit" class="btn btn-danger btn-danger-custom" 
                            data-confirm="最后确认：确定要删除资产 '{{ asset.name }}' 吗？&#10;&#10;此操作将：&#10;- 删除资产记录&#10;- 保留操作日志&#10;- 无法恢复资产数据">
                        <i class="fas fa-trash"></i> 确认删除
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
{% endblock %}

{% block extra_js %}
<script>
// 页面加载时的动画效果
document.addEventListener('DOMContentLoaded', function() {
    // 添加淡入动画
    const elements = document.querySelectorAll('.delete-warning, .asset-info, .alert');
    elements.forEach((element, index) => {
        element.style.opacity = '0';
        element.style.transform = 'translateY(20px)';
        
        setTimeout(() => {
            element.style.transition = 'all 0.5s ease';
            element.style.opacity = '1';
            element.style.transform = 'translateY(0)';
        }, index * 200);
    });
});
</script>
{% endblock %}